<?php
class Comment extends Eloquent
{
    public function house()
    {
        return $this->belongs_to('House');
    }

    public function get_time()
    {
        $time = $this->get_attribute('updated_at');
        if (gettype($time) == 'string') {
            return date('H:i d/m/Y', strtotime($time));
        }
        return $time->format('H:i d/m/Y');
    }

    public static function by_house($house_id, $offset = 0, $limit = 10)
    {
        return static::where_house_id($house_id)->skip($offset)->take($limit)->get();
    }

    public static function count_by_house($house_id = null)
    {
        return static::where_house_id($house_id)->count();
    }
}